package top.hyz.hrm.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import top.hyz.hrm.AjaxResult;
import top.hyz.hrm.CourseDoc;
import top.hyz.hrm.repository.CourseDocRepository;

/**
 * @ClassName ElasticSearchController
 * @Description ES控制器
 * @Author 韩雨泽
 * @Date 2021/1/21-15:13
 * @Version 1.0
 */
@RestController
@RequestMapping("/es")
public class ElasticSearchController {

    @Autowired
    private CourseDocRepository courseDocRepository;

    /**
     * 添加课程信息
     *
     * @return ajaxResult
     */
    @RequestMapping(value = "/online", method = RequestMethod.POST)
    public AjaxResult onLineCourse(@RequestBody CourseDoc courseDoc) {
        courseDocRepository.save(courseDoc);
        return AjaxResult.me();
    }
}
